
function cambiar_login() {
  document.querySelector('.cont_forms').className = "cont_forms cont_forms_active_login";  
document.querySelector('.cont_form_login').style.display = "block";
document.querySelector('.cont_form_sign_up').style.opacity = "0";               

setTimeout(function(){  document.querySelector('.cont_form_login').style.opacity = "1"; },400);  
  
setTimeout(function(){    
document.querySelector('.cont_form_sign_up').style.display = "none";
},200);  
  }

function cambiar_sign_up(at) {
  document.querySelector('.cont_forms').className = "cont_forms cont_forms_active_sign_up";
  document.querySelector('.cont_form_sign_up').style.display = "block";
document.querySelector('.cont_form_login').style.opacity = "0";
  
setTimeout(function(){  document.querySelector('.cont_form_sign_up').style.opacity = "1";
},100);  

setTimeout(function(){   document.querySelector('.cont_form_login').style.display = "none";
},400);  


}






function ocultar_login_sign_up() {

document.querySelector('.cont_forms').className = "cont_forms";  
document.querySelector('.cont_form_sign_up').style.opacity = "0";               
document.querySelector('.cont_form_login').style.opacity = "0"; 

setTimeout(function(){
document.querySelector('.cont_form_sign_up').style.display = "none";
document.querySelector('.cont_form_login').style.display = "none";
},500);  
  
  }

function a4()//注册用户名检查
{
  $.ajax({
    url:"/usregist",
    data:{"name":$("#un").val()},
    success:function (data)
    {
      if(data.toString()=="用户名可用")
      {
        $("#registInfo").css("color","green");
        $("#registInfo").html(data);
      }
      if (data.toString()=="用户名已存在请重新输入")
      {
        $("#registInfo").css("color","red");
        $("#registInfo").html(data);
      }
      if (data.toString()=="用户名不能为空")
      {
        $("#registInfo").css("color","red");
        $("#registInfo").html(data);
      }

    }
  })
}
function a3()//注册检查
{
  $.ajax({
    url:"/regist",
    data:{"username":$("#un").val(),
      "password":$("#password").val(),
      "repassword":$("#repassword").val()

    },
    success:function (data)
    {
      console.log(data);
      if (data.toString()=="请重新确认密码")
      {

        $("#repswinfo").css("color","red");
        $("#repswinfo").html(data);
      }
      if (data.toString()=="注册成功")
      {
        alert(data);
        document.getElementById("denglu").click();
      }
      if (data.toString()=="用户名不能为空")
      {
        $("#registInfo").css("color","red");
        $("#registInfo").html(data);
      }
      if(data.toString()=="用户名已存在请重新输入")
      {
        alert(data);
        document.getElementById("un").value="";
      }
    }
  })
}
function a2()//检查密码
{
  $.ajax({
    url:"/pverify",
    data:{"psw":$("#psw").val(),"name":$("#userName").val()},
    success:function (data)
    {
      if(data.toString()=="用户名错误请重试"||data.toString()=="密码错误")
      {
        console.log("jinru");
        alert(data);
        window.location="reLogin";
      }
      if (data.toString()=="密码正确")
      {
        console.log("密码正确");
      }

      else
      {
        alert(data);
        window.location="reLogin";
      }
    }

  })
}
function a1()//检查用户名
{
  console.log("jinru");
  $.ajax({
    url:"/verify",
    data: {"name":$("#userName").val()},
    success:function (data)
    {
      if (data.toString()=="用户名正确")
      {
        $("#userinfo").css("color","green")
        $("#userinfo").html(data);
      }
      if (data.toString()=="用户名错误")
      {
        $("#userinfo").css("color","red")
        $("#userinfo").html(data);
      }

    }
  })
}